from panda3d.core import CollisionPolygon, Point3


def makeFace(x1, y1, z1, x2, y2, z2):
        
    if x1 != x2:
        quad = CollisionPolygon(Point3(x1, y1, z1), Point3(x2, y1, z1),
                                 Point3(x2, y2, z2), Point3(x1, y2, z2))
    
    else:
        quad = CollisionPolygon(Point3(x1, y1, z1), Point3(x2, y2, z1),
                                Point3(x2, y2, z2), Point3(x1, y1, z2))
    return quad
def generateCollisionCube(x,y,z):
    quad = [0 for a in range(6)]
    quad[0] = makeFace(x + 1, y + 1, z - 1, x, y + 1, z)
    quad[1] = makeFace(x, y, z - 1, x + 1, y, z)
    quad[2] = makeFace(x + 1, y, z - 1, x + 1, y + 1, z)
    quad[3] = makeFace(x, y + 1, z - 1, x, y, z)
    quad[4] = makeFace(x + 1, y + 1, z, x, y, z)
    quad[5] = makeFace(x, y + 1, z - 1, x + 1, y, z - 1)
    return quad